//
//  EditPassViewController.m
//  Mahjong
//
//  Created by KING on 16/9/22.
//  Copyright © 2016年 swift. All rights reserved.
//

#import "EditPassViewController.h"

@interface EditPassViewController ()
<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *myTableView;


@end

@implementation EditPassViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = YES;
    
    self.myTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.myTableView.backgroundColor = [UIColor colorWithRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:1];
    [self.view addSubview:self.myTableView];
    self.myTableView.delegate = self;
    self.myTableView.dataSource = self;
    [self.myTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"];
    self.myTableView.tableFooterView = [[UIView alloc]init];
    [self createButton];
    
    self.navigationItem.title = @"修改密码";
    
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_but_back"] style:(UIBarButtonItemStyleDone) target:self action:@selector(backAction)];
    backItem.tintColor = [UIColor grayColor];
    self.navigationItem.leftBarButtonItem = backItem;
    

}

- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)createButton{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, SCREENH_HEIGHT-40, SCREEN_WIDTH, 40);
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"确定" forState:UIControlStateNormal];
    [self.view addSubview:button];
    [button addTarget:self action:@selector(disAction:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)disAction:(UIButton *)btn{

    [self.navigationController popViewControllerAnimated:YES];
  
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH, 45)];
        text.placeholder = @"| 请输入原密码";
        [cell addSubview:text];
        
        return cell;
    }
    
    if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
            UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH, 45)];
            text.placeholder = @"| 请输入新密码";
            [cell addSubview:text];
            
            return cell;

        }
        else{
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
            UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH, 45)];
            text.placeholder = @"| 再次输入新密码";
            [cell addSubview:text];
            
            return cell;

        }
            }
    
        else{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
        return cell;
        
    }
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 8;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
